package com.drug.mingkang.service.impl;

import com.drug.mingkang.model.AuditRecord;
import com.drug.mingkang.model.HqReview;
import com.drug.mingkang.mapper.HqReviewMapper;
import com.drug.mingkang.model.vo.AuditRecordVo;
import com.drug.mingkang.model.vo.PurchasereviewVo;
import com.drug.mingkang.service.HqReviewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (HqReview)表服务实现类
 *
 * @author wenchangjian
 * @since 2020-08-11 12:00:13
 */
@Service("hqReviewService")
public class HqReviewServiceImpl implements HqReviewService {

    @Resource
    private HqReviewMapper hqReviewMapper;

    @Override
    public int deleteByPurchaseId(String purchaseId) {
        return this.hqReviewMapper.deleteByPurchaseId(purchaseId);
    }

    @Override
    public int selectState(String purchaseId) {
        return this.hqReviewMapper.selectState(purchaseId);
    }

    @Override
    public boolean updateState(String purchaseId, String state) {
        return this.hqReviewMapper.updateState(purchaseId,state);
    }

    /**
     * 通过ID查询单条数据
     *
     * @param reviewId 主键
     * @return 实例对象
     */
    @Override
    public HqReview queryById(String reviewId) {
        return this.hqReviewMapper.queryById(reviewId);
    }

    @Override
    public int selectCount(PurchasereviewVo purchasereviewVo) {
        return this.hqReviewMapper.selectCount(purchasereviewVo);
    }


    /**
     * 新增  fxz
     * @param hqReview
     * @return
     */
    @Override
    public int finsertSelective(HqReview hqReview) {
        return this.hqReviewMapper.finsertSelective(hqReview);
    }

    /**
     * 根据业务ID查询审核记录
     * @param auditRecordVo
     * @return
     */
    @Override
    public List<AuditRecord> findBybusinessId(AuditRecordVo auditRecordVo) {
        return this.hqReviewMapper.findBybusinessId(auditRecordVo);
    }

    /**
     * 查询行数
     * @param auditRecordVo
     * @return
     */
    @Override
    public int fcount(AuditRecordVo auditRecordVo) {
        return this.hqReviewMapper.fcount(auditRecordVo);
    }

    /**
     * 查询多条数据
     *
     * @param purchasereviewVo
     * @return 对象列表
     */
    @Override
    public List<HqReview> queryAllByLimit(PurchasereviewVo purchasereviewVo) {
        return this.hqReviewMapper.queryAllByLimit(purchasereviewVo);
    }

    /**
     * 新增数据
     *
     * @param hqReview 实例对象
     * @return 实例对象
     */
    @Override
    public HqReview insert(HqReview hqReview) {
        this.hqReviewMapper.insert(hqReview);
        return hqReview;
    }

    /**
     * 修改数据
     *
     * @param hqReview 实例对象
     * @return 实例对象
     */
    @Override
    public HqReview update(HqReview hqReview) {
        this.hqReviewMapper.update(hqReview);
        return this.queryById(hqReview.getReviewId());
    }

    /**
     * 通过主键删除数据
     *
     * @param reviewId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String reviewId) {
        return this.hqReviewMapper.deleteById(reviewId) > 0;
    }
}